<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多个组件的过渡</title>
    <script src="vue.js"></script>

</head>
<body>  
      <style>
        .fade-enter-active,.fade-leave-active{
            transition: opacity .5s ease;
        }
        .fade-enter,.fade-leave-to{
            opacity:0;
        }
    </style>
    <!--
        定义登录组件
    -->
    <template id="example1">
        <sqan>你好啊，欢迎登录</sqan>
    </template>
    <!--
        定义注册组件
    -->
    <template id="example2">
        <sqan>你好啊，你注册成功啦</sqan>
    </template>
    <div id="app">
        <a href="javascript:;"@click="compontentName='example1'">登录</a>
        <a href="javascript:;"@click="compontentName='example2'">注册</a>
        <transition name="face" mode="in-out">
            <component :is="compontentName"></component>

        </transition>
        <script>
            Vue.component('example1',{template:'#example1'})
            Vue.component('example2',{template:'#example2'})
            var vm =new Vue({
                el:'#app',
                data:{compontentName:''}
            })
        </script>
    </div>
</body>
</html>